Skip to content

Conversation

@RylanBot
Copy link
Collaborator

@RylanBot RylanBot commented Oct 29, 2025

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

💡 需求背景和解决方案

📝 更新日志

  • fix(Select): 修复在选中选项后,输入框被清空但未触发对应的 onSearch 回调问题

  • fix(Select): 修复开启 onSearchmultiple 时,选中选项丢失的问题

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@RylanBot RylanBot force-pushed the rylan/fix/select/search branch from ad40198 to 7d7c91b Compare October 29, 2025 13:16
@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 29, 2025

tdesign-react-demo

npm i https://pkg.pr.new/tdesign-react@3926

commit: 27d6653

@github-actions
Copy link
Contributor

github-actions bot commented Oct 29, 2025

完成

@RylanBot RylanBot force-pushed the rylan/fix/select/search branch from 11c59cf to 27d6653 Compare October 29, 2025 13:21
@RylanBot RylanBot requested a review from Copilot October 29, 2025 13:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the Select component's remote search functionality by preserving selected options in the value-to-option mapping and triggering initial search on dropdown open. The changes enable the Select component to properly handle remote search scenarios where options are dynamically fetched.

  • Preserves selected options in mapping to prevent state loss during remote searches
  • Triggers search on dropdown open when search handler exists and input is empty
  • Updates remote-search example to demonstrate both single and multiple select modes with loading states

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/components/select/hooks/useOptions.ts Adds logic to merge previous selected options into the value-to-option mapping and exports helper function for value selection checking
packages/components/select/base/Select.tsx Calls onSearch with empty string when dropdown opens for remote search initialization
packages/components/select/_example/remote-search.tsx Rewrites example to showcase both single and multiple select with proper remote search implementation
test/snap/snapshots/ssr.test.jsx.snap Updates SSR snapshot to reflect new example structure with Space component
test/snap/snapshots/csr.test.jsx.snap Updates CSR snapshot to reflect new example structure with loading states

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants